package com.community.sqlapp.service.biz;

import com.community.sqlapp.entity.testCaseTemplate.TestCaseOnesTemplate;
import com.community.sqlapp.entity.testCaseTemplate.TestCaseMeterSphereTemplate;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;

/**
 * 设置Excel模版表头类
 */
public class TestCaseTypeHeaderSets {
    /***
     * &Desc: 设置MeterSphere用例列头
     * @param sheet 工作sheet
     * @param cellStyle 单元格格式
     * @return void
     */
    public static void setSheetColumnHeader(Sheet sheet, CellStyle cellStyle){
        // 创建表头
        Row testcaseTitle = sheet.createRow(0);
        Cell testNameCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.TESTCASENAME);
        testNameCell.setCellValue("用例名称");
        testNameCell.setCellStyle(cellStyle);
        Cell testCatalogCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.TESTCASECATALOG);
        testCatalogCell.setCellValue("所属模块");
        testCatalogCell.setCellStyle(cellStyle);
        Cell testCaseTypeCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.TESTCASETYPE);
        testCaseTypeCell.setCellValue("标签");
        testCaseTypeCell.setCellStyle(cellStyle);
        Cell predicationCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.PREDICATION);
        predicationCell.setCellValue("前置条件");
        predicationCell.setCellStyle(cellStyle);
        Cell detailCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.DETAILS);
        detailCell.setCellValue("备注");
        detailCell.setCellStyle(cellStyle);
        Cell stepCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.ACTIONS);
        stepCell.setCellValue("步骤描述");
        stepCell.setCellStyle(cellStyle);
        Cell expectCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.RESULTS);
        expectCell.setCellValue("预期结果");
        expectCell.setCellStyle(cellStyle);
        Cell uadateModelCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.UPDATEMODELS);
        uadateModelCell.setCellValue("编辑模式");
        uadateModelCell.setCellStyle(cellStyle);
        Cell caseStatusCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.CASESTATUS);
        caseStatusCell.setCellValue("用例状态");
        caseStatusCell.setCellStyle(cellStyle);
        Cell caseUsersCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.CASEUSERS);
        caseUsersCell.setCellValue("责任人");
        caseUsersCell.setCellStyle(cellStyle);
        Cell importanceCell = testcaseTitle.createCell(TestCaseMeterSphereTemplate.PRIORITY);
        importanceCell.setCellValue("用例等级");
        importanceCell.setCellStyle(cellStyle);
    }

    /**
     * &Desc: 设置ones表头
     * @param sheet 工作sheet
     * @param cellStyle 单元格格式
     */
    public static void setSheetOnesColumnHeader(Sheet sheet, CellStyle cellStyle) {
        // 创建表头
        Row testcaseTitle = sheet.createRow(0);
        Cell testCatalogCell_1 = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASECATALOG_1);
        testCatalogCell_1.setCellValue("一级模块");
        testCatalogCell_1.setCellStyle(cellStyle);
        Cell testCatalogCell_2 = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASECATALOG_2);
        testCatalogCell_2.setCellValue("二级模块");
        testCatalogCell_2.setCellStyle(cellStyle);
        Cell testCatalogCell_3 = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASECATALOG_3);
        testCatalogCell_3.setCellValue("三级模块");
        testCatalogCell_3.setCellStyle(cellStyle);
        Cell testCatalogCell_4 = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASECATALOG_4);
        testCatalogCell_4.setCellValue("四级模块");
        testCatalogCell_4.setCellStyle(cellStyle);
        Cell testCatalogCell_5 = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASECATALOG_5);
        testCatalogCell_5.setCellValue("五级模块");
        testCatalogCell_5.setCellStyle(cellStyle);
        Cell testCatalogCell_6 = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASECATALOG_6);
        testCatalogCell_6.setCellValue("六级模块");
        testCatalogCell_6.setCellStyle(cellStyle);
        Cell testNameCell = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASENAME);
        testNameCell.setCellValue("用例名称");
        testNameCell.setCellStyle(cellStyle);
        Cell importanceCell = testcaseTitle.createCell(TestCaseOnesTemplate.PRIORITY);
        importanceCell.setCellValue("优先级");
        importanceCell.setCellStyle(cellStyle);
        Cell testCaseTypeCell = testcaseTitle.createCell(TestCaseOnesTemplate.TESTCASETYPE);
        testCaseTypeCell.setCellValue("用例类型");
        testCaseTypeCell.setCellStyle(cellStyle);
        Cell predicationCell = testcaseTitle.createCell(TestCaseOnesTemplate.PREDICATION);
        predicationCell.setCellValue("前置条件");
        predicationCell.setCellStyle(cellStyle);
        Cell stepCell = testcaseTitle.createCell(TestCaseOnesTemplate.ACTIONS);
        stepCell.setCellValue("步骤描述");
        stepCell.setCellStyle(cellStyle);
        Cell expectCell = testcaseTitle.createCell(TestCaseOnesTemplate.RESULTS);
        expectCell.setCellValue("预期结果");
        expectCell.setCellStyle(cellStyle);
        Cell detailCell = testcaseTitle.createCell(TestCaseOnesTemplate.DETAILS);
        detailCell.setCellValue("备注");
        detailCell.setCellStyle(cellStyle);
        Cell caseUsersCell = testcaseTitle.createCell(TestCaseOnesTemplate.CASEUSERS);
        caseUsersCell.setCellValue("维护人");
        caseUsersCell.setCellStyle(cellStyle);
    }
}
